//
//  DBManager.h
//  Alarm
//
//  Created by apple on 2025/8/20.
//


#import <Foundation/Foundation.h>
#import <sqlite3.h>

NS_ASSUME_NONNULL_BEGIN


// 定义一个Block类型，用于传递查询结果
typedef void (^QueryResultBlock)(BOOL success, NSArray * _Nonnull resultArr, NSString * _Nullable msg);

// 定义一个Block类型，用于执行完成的回调
typedef void (^CompletionBlock)(BOOL success, NSString * _Nullable msg);


@interface DBManager : NSObject

// 单例访问点
+ (instancetype)sharedManager;

// 插入数据
- (void) insertData:(NSDictionary *)params completion:(CompletionBlock _Nullable)completion;

// 更新数据
- (void) updateData:(NSDictionary *)params completion:(CompletionBlock _Nullable)completion;

// 删除数据
- (void) deleteDataTag:(NSString *)tag withAlarmId:(NSString *)alarmId completion:(CompletionBlock _Nullable)completion;

// 查找数据
- (void) queryDataTag:(NSString *)tag withAlarmId:(NSString *)alarmId completion:(QueryResultBlock _Nullable)completion;

@end

NS_ASSUME_NONNULL_END

